(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
/**
  1. 暴露数据:
        module.exports = value;
        exports.xxx = value;
  2. 引入数据:
    	const module = require(模块名或模块路径);
 */
//如何使用一个模块，取决于：模块的编写者暴露的是什么
const m1 = require('./modules/module1')
const {jia,jian} = require('./modules/module2')
let m3 = require('./modules/module3')
const uniq = require('uniq')

console.log(m1) //输出m1暴露的字符串
console.log(jia(1,2)) //调用jia
console.log(jian(7,3)) //调用jian
console.log(m3) //输出m3

//演示保护内部实现
m3 = [1,3,5,7,9] // 对m3进行修改
//m3.age = 99 //注意：此行的修改会影响模块3中person的age
console.log(m3) // [1,3,5,7,9] 
let m33 = require('./modules/module3') //再次引入模块3
console.log(m33) // {name:'tom',age:18,sex:'男'}

//测试一下uniq
const arr = [1,1,10,3,2,4,4,4,6,5]
const result = uniq(arr)
console.log(result)

},{"./modules/module1":2,"./modules/module2":3,"./modules/module3":4,"uniq":5}],2:[function(require,module,exports){
const school = '尚硅谷'
const address = '宏福科技园'

function sayHello(){
	console.log('hello!')
}

//暴露数据
module.exports = address


},{}],3:[function(require,module,exports){
//module.exports只能写一次，若写了多次以最后一次为准

function increment (a,b){
	return a+b
}

function decrement (a,b){
	return a-b
}

//使用module.exports暴露数据
/* module.exports = {
	jia:increment,
	jian:decrement
} */

//使用exports.xxx暴露数据
exports.jia = increment
exports.jian = decrement




},{}],4:[function(require,module,exports){
const person = {
	name:'tom',
	age:18,
	sex:'男'
}

module.exports = person
// exports.ren = person
},{}],5:[function(require,module,exports){
"use strict"

function unique_pred(list, compare) {
  var ptr = 1
    , len = list.length
    , a=list[0], b=list[0]
  for(var i=1; i<len; ++i) {
    b = a
    a = list[i]
    if(compare(a, b)) {
      if(i === ptr) {
        ptr++
        continue
      }
      list[ptr++] = a
    }
  }
  list.length = ptr
  return list
}

function unique_eq(list) {
  var ptr = 1
    , len = list.length
    , a=list[0], b = list[0]
  for(var i=1; i<len; ++i, b=a) {
    b = a
    a = list[i]
    if(a !== b) {
      if(i === ptr) {
        ptr++
        continue
      }
      list[ptr++] = a
    }
  }
  list.length = ptr
  return list
}

function unique(list, compare, sorted) {
  if(list.length === 0) {
    return list
  }
  if(compare) {
    if(!sorted) {
      list.sort(compare)
    }
    return unique_pred(list, compare)
  }
  if(!sorted) {
    list.sort()
  }
  return unique_eq(list)
}

module.exports = unique

},{}]},{},[1]);
